﻿using System;
using System.Collections.Generic;
using System.Text;

namespace iPdf
{
    class MergePage : ActionPage<MergeItem, PdfLetOption>
    {
        public override PdfLetOption PdfLets
        {
            get
            {
                return new PdfLetOption(true, false, false);
            }
        }

        protected override PdfLetOption PageOption
        {
            get
            {
                return Global.MainWindow.PdfLets;
            }
        }

        public override bool OrderMatters
        {
            get
            {
                return true;
            }
        }

        public override bool ReadyToAct
        {
            get
            {
                return Global.Grid.RowsCount > 2;
            }
        }

        public override string IntroInfo
        {
            get
            {
                return global::iPdf.Properties.Resources.MergePageIntroInfo;
            }
        }

        public MergePage()
            : base()
        {
            visibleColumns.Add(Global.Grid.From);
            visibleColumns.Add(Global.Grid.To);

            actor = new PdfMerger();
        }

        protected override MergeItem GetIthActionItem(TataGrid grid, int i)
        {
            MergeItem item = new MergeItem();
            item.Source = (string)grid.Source.GetValueAt(i);
            item.From = (int)grid.From.GetValueAt(i);
            item.To = (int)grid.To.GetValueAt(i);

            return item;
        }

    }
}
